class Task68_2:
    def run(self, tree, node1, node2):
        # node has 'parent' property
        list1_length = 0
        node = node1
        while node is not None:
            list1_length += 1
            node = node.parent

        list2_length = 0
        node = node2
        while node is not None:
            list2_length += 1
            node = node.parent

        if list2_length > list1_length:
            list1_length, list2_length = list2_length, list1_length
            node1, node2 = node2, node1

        for _ in range(list1_length - list2_length):
            node1 = node1.parent
        while node1 != node2:
            node1 = node1.parent
            node2 = node2.parent
        return node1
